package com.cust.cow.controller;

import com.cust.cow.common.Result;
import com.cust.cow.service.BreedService;
import com.cust.cow.pojo.breed;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin("*")
@RequestMapping("/breed")
public class BreedController {
    @Autowired
    public BreedService breedService;

    /**
     * 查询所有品种
     * @return
     */
    @RequestMapping("findBreedAll")
    public List<breed> findBreedAll(){
        return breedService.findBreedAll();
    }

    /**
     * 添加牛品种
     */
    @PostMapping("/insertBreed")
    public Result insertBreed(@RequestBody breed breed){
        return breedService.insertBreed(breed);
    }

    /**
     * 删除牛品种
     */
    @GetMapping("/deleteBreed")
    public Result deleteBreed(@RequestParam("breedName") String breedName){
        return breedService.deleteBreed(breedName);
    }

    /**
     * 修改
     */
}
